<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
     <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<script type="text/javascript" src="jquery-1.7.1.js"></script>
	
	<body>
		<form method="post" action="customers">
			<h1>My Flights</h1>
			<br><br>
			<div id="div1">
			<table cellspacing=20>
				<tr>
					<td>Air Lines</td>
					<td>Aircraft</td>
					<td>Ticket Number</td>
					<td>Departure Date</td>
					<td>Passport</td>
					<td>Nationality</td>
					<td>Ticket Status</td>
				</tr>
				<tr>
				<c:forEach var="c" items="${sessionScope.customers}">
					<td><a style="color:blue;" href="javascript:getAFlight('${c.alid}', '${c.aircraft}', '${c.date}');">${c.aircraft}</a></td>
					<td>${c.alid}</td>
					<td>${c.ticketnum}</td>
					<td>${c.date}</td>
					<td>${c.passport}</td>
					<td>${c.nationality}</td>
					<td>${c.status}</td>
				</c:forEach>
				</tr>
			</table>
			</div>

			<div id="div2">
			<h2>Flight Info</h2>
			<table cellspacing=20>
				<tr>
					<td>Air Lines</td>
					<td>Aircraft</td>
					<td>Source</td>
					<td>Destination</td>
					<td>Departure Date</td>
					<td>Departure Time</td>
					<td>Arrival Date</td>
					<td>Arrival Time</td>
					<td>Flight Status</td>
				</tr>
				<tr>
					<td>${flight.alid}</td>
					<td>${flight.aircraft}</td>
					<td>${flight.source}</td>
					<td>${flight.destination}</td>
					<td>${flight.deptdate}</td>
					<td>${flight.deptime}</td>
					<td>${flight.arrvdate}</td>
					<td>${flight.arrvtime}</td>
					<td>${flight.status}</td>
				</tr>
			</table>
			</div>



		<input id="pageVal" type="hidden" name="pageVal"/>
		<input id="submit" type="submit" name="submit" value="submit"/>
		
			<input id="alid" type="hidden" name="alid"/>
			<input id="date" type="hidden" name="date"/>
			<input id="aircraft" type="hidden" name="aircraft"/>
			
		</form>
		

<script language="JavaScript" type="text/JavaScript">

	$(window).load(function(){
		$("#submit").hide();
		if('${userSession}' ==  "" || '${userSession}' ==  null)
			self.location = "customerLogin.jsp";
		if('${divn}' == "GF")
			$("div2").show();
	});
	
	function getAFlight(alid, aircraft, date)
	{
		$("#pageVal").val('GF');
		$("#submit").click();
	}

	</script>
		
	</body>
</html>
